package ks2;

public class Mat {
    final int MAXSIZE = 10;
    int mu, nu, tu;
    int rpos[] = new int[MAXSIZE + 1];// 各行第一个非零元的位置表
    Triple<Integer> data[] = new Triple[MAXSIZE + 1];// Java不支持泛型数组

    public Mat(int mu, int nu, int tu) {
        this.mu = mu;
        this.nu = nu;
        this.tu = tu;
        for (int i = 1; i <= MAXSIZE; i++)
            data[i] = new Triple();
    }

    // 三元组矩阵的输出
    public void display() {
        int i, j, k, count = 0;
        for (i = 1; i <= mu; i++) {
            for (j = 1; j <= nu; j++) {
                for (k = 1; k <= tu; k++) {
                    if (i == data[k].row && j == data[k].col) {
                        System.out.print(data[k].v + " ");
                        count = -1;
                        break;
                    }
                }
                if (count != -1)
                    System.out.print("0 ");
                count = 0;
            }
            System.out.println();
        }
    }

    public int tu(int i) {
        return 0;
    }

}